Skip to content

dgb: won_share_inputs seam — share-side half of #82 faithful reconstruct closure - #279

Merged
frstrtr merged 1 commit into
masterfrom
dgb/won-share-inputs-seam
Jun 20, 2026
Merged

dgb: won_share_inputs seam — share-side half of #82 faithful reconstruct closure#279
frstrtr merged 1 commit into
masterfrom
dgb/won-share-inputs-seam

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 20, 2026

Copy link
Copy Markdown
Owner

What

Adds dgb::coin::won_share_inputs(share) -> {small_header, merkle_link} — the share-side half of the #82 faithful won-block reconstruct closure (today an interim nullopt stub installed as ShareTracker::m_on_block_found in main_dgb.cpp).

reconstruct_won_block_from_template needs five inputs; two of them the won share carries verbatim and version-agnostically:

  • small_header = share.m_min_header
  • merkle_link = share.m_merkle_link

This seam pulls exactly those two — a pure read of already-validated share_info fields. No PoW / coinbase commitment / share format / PPLNS math touched; p2pool-merged-v36 surface: NONE. Duck-typed on the share to stay off share.hpp tracker/base_uint TU (the limited-TU build trap). Binds to the live dgb::Share in the run-loop once the remaining inputs land (gentx/gentx_hash = inverse of out_gentx #173; template_other_txs = captured-GBT retention #271).

Tests

+2 KATs into existing dgb_reconstruct_won_block_test (no new target → no build.yml allowlist churn): verbatim extraction, and seam-output drives a byte-identical block to passing the fields directly. 9/9 PASS.

Fenced to src/impl/dgb/. GPG-signed. HOLD merge.

…nstruct closure

The won-block reconstruct closure the run-loop installs as
ShareTracker::m_on_block_found is today an interim nullopt stub. The faithful
path (reconstruct_won_block_from_template) needs five inputs; two of them the
won share carries verbatim and version-agnostically: small_header
(m_min_header) and merkle_link (m_merkle_link).

Add dgb::coin::won_share_inputs(share) -> {small_header, merkle_link}: a pure
read of already-validated share_info fields (no PoW / coinbase commitment /
share format / PPLNS touched; p2pool-merged-v36 surface NONE). Duck-typed on
the share to stay off share.hpp tracker/base_uint TU (the limited-TU build
trap). Binds to the live dgb::Share in the run-loop once the remaining inputs
(gentx/gentx_hash inverse-of-out_gentx, template_other_txs retention) land.

+2 KATs into dgb_reconstruct_won_block_test (existing target, no allowlist
churn): verbatim extraction, and seam-output drives a byte-identical block to
passing the fields directly. 9/9 PASS. Fenced to src/impl/dgb/.
@frstrtr
frstrtr merged commit 49ce293 into master Jun 20, 2026
29 checks passed
frstrtr added a commit that referenced this pull request Jun 23, 2026
…nstruct closure (#279)

The won-block reconstruct closure the run-loop installs as
ShareTracker::m_on_block_found is today an interim nullopt stub. The faithful
path (reconstruct_won_block_from_template) needs five inputs; two of them the
won share carries verbatim and version-agnostically: small_header
(m_min_header) and merkle_link (m_merkle_link).

Add dgb::coin::won_share_inputs(share) -> {small_header, merkle_link}: a pure
read of already-validated share_info fields (no PoW / coinbase commitment /
share format / PPLNS touched; p2pool-merged-v36 surface NONE). Duck-typed on
the share to stay off share.hpp tracker/base_uint TU (the limited-TU build
trap). Binds to the live dgb::Share in the run-loop once the remaining inputs
(gentx/gentx_hash inverse-of-out_gentx, template_other_txs retention) land.

+2 KATs into dgb_reconstruct_won_block_test (existing target, no allowlist
churn): verbatim extraction, and seam-output drives a byte-identical block to
passing the fields directly. 9/9 PASS. Fenced to src/impl/dgb/.

Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr added a commit that referenced this pull request Jun 23, 2026
…osure builder

Compose the run-loop WonBlockReconstructor from the captured-GBT template
source (#271) instead of the share tx_hash_refs: won_share_inputs (#279,
small_header + merkle_link) ++ unpack_gentx_coinbase(gentx) ++
template_other_txs -> reconstruct_won_block_from_template. Version-agnostic
(dissolves the v34+ no-m_tx_info concern) and fail-closed (any error ->
nullopt, announce + audit, RPC submitblock fallback still attempts).

Seam-injected so it is unit-tested with no live ShareTracker/mempool. +5
KAT into dgb_reconstruct_closure_test (existing target, no new allowlist
entry): success==reconstruct_won_block_from_template, empty-template=>valid
coinbase-only (not nullopt), unknown-share / malformed-gentx / template-throw
each fail closed. 11/11 PASS. src/impl/dgb/ only; p2pool-merged-v36 surface
NONE. This is the builder the main_dgb run-loop installs in place of the
nullopt stub (next slice).
frstrtr added a commit that referenced this pull request Jun 23, 2026
… nullopt stub)

main_dgb.cpp --run binds tracker().m_on_block_found to the FAITHFUL
make_reconstruct_closure_from_template (#280) in place of the interim
nullopt stub. The three version-agnostic won-block inputs are bound to
the live sharechain tracker:
  - won_share_fields_fn: share.m_min_header + m_merkle_link (#279)
  - gentx_bytes_fn: generate_share_transaction(...).GentxCoinbase.bytes
    (#173 SSOT); v36_active re-derived from the share compile-time
    version inside GST, byte-identical to the verify-path invocation
  - template_other_txs_fn: captured-GBT non-coinbase set (#271), empty
    today (no per-job template retention + unfed embedded mempool =>
    coinbase-only), correct-and-empty, NOT fail-closed

Fires on the compute thread already holding the tracker lock, so the
fns read tracker().chain directly (no read_tracker(), no self-deadlock).
Fail-closed end to end: any builder error -> nullopt (announce + audit;
RPC submitblock fallback still fires). Fenced to main_dgb.cpp; build
EXIT=0; selftest OK. #82 OPEN pending a live UpdateTip won-block test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant